<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateProjectCheckListTable extends AbstractMigration
{
    public function up()
    {
        $table = $this->table('project_check_list', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '项目工序审核节点表']);

        //添加数据字段
        $table->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '审核清单ID'])
            ->addColumn('check_list_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '审核点ID'])
//            ->addColumn('step_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '工序ID'])
//            ->addColumn('percentage', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '审核点百分比'])
//            ->addColumn('review_tools', 'enum', ['values' => 'online,local,download', 'default' => 'online', 'comment' => '审核工具'])
//            ->addColumn('content', 'string', ['default' => '', 'limit' => 255, 'comment' => '审核清单内容'])
            ->addColumn('uuid', 'char', ['default' => '', 'limit' => 36, 'comment' => '全局唯一标识符'])
//            ->addColumn('attr_str', 'string', ['null' => false, 'default' => '', 'limit' => 256, 'comment' => '属性str',])
            ->addColumn('project_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '项目模板ID'])
//            ->addColumn('step_workflow_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '关联审核工序id'])
            ->addColumn('review_role_config', 'string', ['default' => '', 'null' => false, 'limit' => 256, 'comment' => '审核节点的审核角色']);

        //执行创建
        $table->create();
    }

    public function down()
    {
        $this->table('project_check_list')->drop()->save();
    }
}
